﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DISDisplay
{
    public partial class Setup_frm : Form
    {
        public Setup_frm()
        {
            InitializeComponent();
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                panel1.BackColor = colorDialog1.Color;
            }
        }

        private void panel1_Paint_1(object sender, PaintEventArgs e)
        {

        }

        private void label1_Click_1(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            DataBase db = new DataBase(textBox1.Text, textBox3.Text, textBox6.Text, textBox2.Text);
            if (db.checkConnection())
            {
                MessageBox.Show("Prie duomenų bazės prisijungta!", "Prisijungimo tikrinimas", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show("Neprisijungiama prie duomenų bazės!", "Prisijungimo tikrinimas", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Configuration.saveParameters(textBox4, textBox5, textBox7, textBox8, panel1.BackColor, panel2.BackColor, panel3.BackColor, textBox1, textBox2, textBox3, textBox6, checkBox1, checkBox2,checkBox3,panel4.BackColor,panel5.BackColor,textBox9,panel6.BackColor,textBox10,textBox13,textBox12,textBox11,textBox15,textBox14,textBox17,textBox16,textBox18);
        }

        private void Setup_frm_Shown(object sender, EventArgs e)
        {
            Configuration.addVariablesToForm(textBox4, textBox5, textBox7, textBox8, panel1, panel2, panel3, textBox1, textBox2, textBox3, textBox6, checkBox1, checkBox2, checkBox3, panel4, panel5, textBox9, trackBar1, panel6, textBox10, textBox13, textBox12, textBox11, textBox15, textBox14, textBox17, textBox16, textBox18);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                panel2.BackColor = colorDialog1.Color;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                panel3.BackColor = colorDialog1.Color;
            }
        }

        private void checkBox3_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox3.Checked)
            {
                groupBox2.Enabled = true;
            }
            else
            {
                groupBox2.Enabled = false;
            }
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            textBox9.Text = trackBar1.Value.ToString();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                panel4.BackColor = colorDialog1.Color;
            }
        }

        private void button8_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                panel5.BackColor = colorDialog1.Color;
            }
        }

        private void button9_Click(object sender, EventArgs e)
        {
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                panel6.BackColor = colorDialog1.Color;
            }
        }
    }
}
